<?php
App::uses('AppController', 'Controller');

class ProductsController extends AppController {

	public function index() {

		$products = $this->Product->find('all', array(
			'contain' => array('Category'),
		));
		$this->set(array(
				'products' => $products,
		));
	}

	public function view($id) {

		// find product by id
		$product = $this->Product->find('first', array(
			'conditions' => array('Product.id' => $id),
		));

		$this->set(array(
			'product' => $product,
		));
	}

}
